<?php
/**
 * User: Lijun
 * Date: 2017/6/5.
 * Time: 11:21.
 * Comment: 登录控制
 */

namespace Admin\Controller;
use Think\Controller;

class LoginController extends Controller{
    public function index(){
        $this -> display();
    }

    public function Login(){
        if($_POST['username'] == 'admin' && md5($_POST['pwd']) == 'dc483e80a7a0bd9ef71d8cf973673924'){
            session('isLogin',1);
            session('username','admin');
            $this -> success("登陆成功",U('Index/index'));
        }else{
            session('isLogin',0);
            $this -> error("密码不正确");
        }
    }

    public function loginOut(){
        session('isLogin',0);
        $this -> success('退出登录',U('index'));
    }
}